import VideoBucket from "@/pages/FbPage/BucketViewer/VideoBucket";
import {FbInfo} from "@/api/web/FileBucketApi.ts";
import ImageBucket from "@/pages/FbPage/BucketViewer/ImageBucket";
import MarkdownBucket from "@/pages/FbPage/BucketViewer/MarkdownBucket";
import DefaultBucket from "@/pages/FbPage/BucketViewer/DefaultBucket";
import MusicBucket from "@/pages/FbPage/BucketViewer/MusicBucket";

interface FbType {
    value: string,
    label: string,
    contentTypePrefix?: string
}

export const FbTypes: FbType[] = [
    {value: "default", label: "默认"},
    {value: "video", label: "视频", contentTypePrefix: "video"},
    {value: "image", label: "图片", contentTypePrefix: "image"},
    {value: "markdown", label: "md文档", contentTypePrefix: "text"},
    {value: "audio", label: "音乐", contentTypePrefix: 'audio'},
]

export const getFbViewer = (fbInfo: FbInfo, pathList: string[]) => {
    switch (fbInfo.type) {
        case "video" :
            return <VideoBucket fbInfo={fbInfo} pathList={pathList}/>
        case "image" :
            return <ImageBucket fbInfo={fbInfo} pathList={pathList}/>
        case "markdown" :
            return <MarkdownBucket fbInfo={fbInfo} pathList={pathList}/>
        case "audio" :
            return <MusicBucket fbInfo={fbInfo} pathList={pathList}/>
        default :
            return <DefaultBucket fbInfo={fbInfo} pathList={pathList}/>
    }
}
